package com.igor.reporting.dao.contactPerson;

import java.util.List;

import org.apache.tapestry5.ioc.annotations.Inject;
import org.hibernate.Session;

import com.igor.reporting.entities.contactPerson.ContactPerson;

public class ContactPersonDAOImpl implements ContactPersonDAO {

	@Inject
	private Session session;

	public void add(ContactPerson c) {
		if (c != null) {
			session.save(c);
		}
	}

	public void delete(ContactPerson c) {
		if (c != null) {
			session.delete(c);
		}
	}

	public void update(ContactPerson c) {
		if (c != null) {
			session.update(c);
		}
	}

	public ContactPerson find(Long id) {
		return (ContactPerson) session.load(ContactPerson.class, id);
	}

	public List<ContactPerson> findAll() {
		return session.createCriteria(ContactPerson.class).list();
	}

}
